package io.gitee.zicai.bus.listener;

import io.gitee.zicai.bus.adaptor.IBusSendAdaptor;
import io.gitee.zicai.bus.bus.ISendBus;
import io.gitee.zicai.bus.core.IBusSender;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.Async;

/**
 * EventBusSendListener
 *
 * @author zicai
 * @since 2021-01-20
 */
@Slf4j
public class EventBusSendListener<S extends IBusSender, SB extends ISendBus<S, ST>, ST> extends BaseBusSendListener<S, SB, ST> {

    @Autowired
    private IBusSendAdaptor<S, SB, ST> cmdSendAdaptor;

    @Async("busAsyncPool")
    @EventListener
    public void cmdSendHandler(SB bus) {
        super.cmdSendHandler(cmdSendAdaptor, bus);
    }
}
